# Copyright The Slam Authors

message(STATUS "Enter slam ros sub directory")
# message(STATUS "PCL_INCLUDE_DIRS: ${PCL_INCLUDE_DIRS}")
# message(STATUS "PCL_LIBRARY_DIRS: ${PCL_LIBRARY_DIRS}")

include_directories(..) 

add_executable(slam_assets_writer
  assets_writer_main.cc
  ros_map_writing_points_processor.h
  ros_map_writing_points_processor.cc
)

target_include_directories(slam_assets_writer 
  PRIVATE 
    ${LUA_INCLUDE_DIR}
    ${PCL_INCLUDE_DIRS}
)

target_link_libraries(slam_assets_writer 
  ${LUA_LIBRARIES}
  glog::glog
  absl::strings
  slam
  slam_ros
  rclcpp::rclcpp
  pcl_common
  pcl_io
  pcl_visualization
)

install(TARGETS slam_assets_writer
  ARCHIVE DESTINATION lib/${PROJECT_NAME}
  LIBRARY DESTINATION lib/${PROJECT_NAME}
  RUNTIME DESTINATION lib/${PROJECT_NAME}
)

add_executable(slam_node
  node_main.cc
)

target_include_directories(slam_node 
  SYSTEM PUBLIC
    ${LUA_INCLUDE_DIR}
    slam_ros_msgs
    agv_msgs 
)

target_link_libraries(slam_node ${PROJECT_NAME})

ament_target_dependencies(slam_node
  "agv_msgs"
  "slam_ros_msgs"
  "geometry_msgs"
  "nav_msgs"
  "pcl_conversions"
  "rclcpp"
  "std_msgs"
  "sensor_msgs"
  "tf2"
  "tf2_msgs"
  "tf2_ros"
  "visualization_msgs"
)

install(TARGETS slam_node
  ARCHIVE DESTINATION lib/${PROJECT_NAME}
  LIBRARY DESTINATION lib/${PROJECT_NAME}
  RUNTIME DESTINATION lib/${PROJECT_NAME}
)

add_executable(slam_ros_node
  slam_ros_node_main.cc
)

target_include_directories(slam_ros_node 
  PRIVATE 
    ${LUA_INCLUDE_DIR}
    ${EIGEN3_INCLUDE_DIR}
    ${TF2_INCLUDE_DIR}
    slam_ros_msgs
    tf2_geometry_msgs
)

target_link_libraries(slam_ros_node ${PROJECT_NAME})

ament_target_dependencies(slam_ros_node
  "agv_msgs"
  "agv_srvs"
  "slam_ros_msgs"
  "geometry_msgs"
  "nav_msgs"
  "pcl_conversions"
  "rclcpp"
  "std_msgs"
  "sensor_msgs"
  "tf2"
  "tf2_msgs"
  "tf2_ros"
  "tf2_geometry_msgs"
  "visualization_msgs"
)

install(TARGETS slam_ros_node
  ARCHIVE DESTINATION lib/${PROJECT_NAME}
  LIBRARY DESTINATION lib/${PROJECT_NAME}
  RUNTIME DESTINATION lib/${PROJECT_NAME}
)

add_executable(publish_occupancy_grid_map
  publish_occupancy_grid_map_main.cc
)

target_include_directories(publish_occupancy_grid_map 
  PRIVATE 
    ${nav2_map_server_INCLUDE_DIRS}
    ${rcl_lifecycle_INCLUDE_DIRS}
    ${rclcpp_lifecycle_INCLUDE_DIRS}
    ${smclib_INCLUDE_DIRS}
    ${bondcpp_INCLUDE_DIRS}
    ${LUA_INCLUDE_DIR}
    slam_ros_msgs
)

target_link_libraries(publish_occupancy_grid_map ${PROJECT_NAME})

ament_target_dependencies(publish_occupancy_grid_map
  "agv_msgs"
  "agv_srvs"
  "slam_ros_msgs"
  "geometry_msgs"
  "nav_msgs"
  "pcl_conversions"
  "rclcpp"
  "std_msgs"
  "sensor_msgs"
  "tf2"
  "tf2_msgs"
  "tf2_ros"
  "tf2_geometry_msgs"
  "visualization_msgs"
)

install(TARGETS publish_occupancy_grid_map
  ARCHIVE DESTINATION lib/${PROJECT_NAME}
  LIBRARY DESTINATION lib/${PROJECT_NAME}
  RUNTIME DESTINATION lib/${PROJECT_NAME}
)

add_executable(edit_map
  map_editor_main.cc
  mute_grid.cpp
)

target_include_directories(edit_map 
  PRIVATE 
    ${LUA_INCLUDE_DIR}
    ${nav2_costmap_2d_INCLUDE_DIRS}
    slam_ros_msgs
)

target_link_libraries(edit_map ${PROJECT_NAME})

ament_target_dependencies(edit_map
  "agv_msgs"
  "agv_srvs"
  "slam_ros_msgs"
  "geometry_msgs"
  "nav_msgs"
  "pcl_conversions"
  "rclcpp"
  "std_msgs"
  "sensor_msgs"
  "tf2"
  "tf2_msgs"
  "tf2_ros"
  "tf2_geometry_msgs"
  "visualization_msgs"
)

install(TARGETS edit_map
  ARCHIVE DESTINATION lib/${PROJECT_NAME}
  LIBRARY DESTINATION lib/${PROJECT_NAME}
  RUNTIME DESTINATION lib/${PROJECT_NAME}
)

add_executable(slam_offline_node
  offline_node_main.cc
)

target_include_directories(slam_offline_node 
  PRIVATE 
    slam_ros_msgs
)

target_link_libraries(slam_offline_node ${PROJECT_NAME})

ament_target_dependencies(slam_offline_node
  "agv_msgs"
  "agv_srvs"
  "slam_ros_msgs"
  "geometry_msgs"
  "nav_msgs"
  "pcl_conversions"
  "rclcpp"
  "std_msgs"
  "sensor_msgs"
  "tf2"
  "tf2_msgs"
  "tf2_ros"
  "tf2_geometry_msgs"
  "visualization_msgs"
)

install(TARGETS slam_offline_node
  ARCHIVE DESTINATION lib/${PROJECT_NAME}
  LIBRARY DESTINATION lib/${PROJECT_NAME}
  RUNTIME DESTINATION lib/${PROJECT_NAME}
)

add_executable(slam_start_trajectory_initial_pose
  start_trajectory_initial_pose_main.cc
)

target_include_directories(slam_start_trajectory_initial_pose 
  PRIVATE 
    slam_ros_msgs
)

target_link_libraries(slam_start_trajectory_initial_pose ${PROJECT_NAME})

ament_target_dependencies(slam_start_trajectory_initial_pose
  "agv_msgs"
  "agv_srvs"
  "slam_ros_msgs"
  "geometry_msgs"
  "nav_msgs"
  "pcl_conversions"
  "rclcpp"
  "std_msgs"
  "sensor_msgs"
  "tf2"
  "tf2_msgs"
  "tf2_ros"
  "tf2_geometry_msgs"
  "visualization_msgs"
)

install(TARGETS slam_start_trajectory_initial_pose
  ARCHIVE DESTINATION lib/${PROJECT_NAME}
  LIBRARY DESTINATION lib/${PROJECT_NAME}
  RUNTIME DESTINATION lib/${PROJECT_NAME}
)

add_executable(slam_occupancy_grid_node
  occupancy_grid_node_main.cc
)

target_include_directories(slam_occupancy_grid_node 
  PRIVATE 
    slam_ros_msgs
)

target_link_libraries(slam_occupancy_grid_node ${PROJECT_NAME})

ament_target_dependencies(slam_occupancy_grid_node
  "agv_msgs"
  "agv_srvs"
  "slam_ros_msgs"
  "geometry_msgs"
  "nav_msgs"
  "pcl_conversions"
  "rclcpp"
  "std_msgs"
  "sensor_msgs"
  "tf2"
  "tf2_msgs"
  "tf2_ros"
  "tf2_geometry_msgs"
  "visualization_msgs"
)

install(TARGETS slam_occupancy_grid_node
  ARCHIVE DESTINATION lib/${PROJECT_NAME}
  LIBRARY DESTINATION lib/${PROJECT_NAME}
  RUNTIME DESTINATION lib/${PROJECT_NAME}
)

add_executable(slam_rosbag_validate
  rosbag_validate_main.cc
)

target_include_directories(slam_rosbag_validate 
  PRIVATE 
    slam_ros_msgs
)

target_link_libraries(slam_rosbag_validate ${PROJECT_NAME})

ament_target_dependencies(slam_rosbag_validate
  "agv_msgs"
  "agv_srvs"
  "slam_ros_msgs"
  "geometry_msgs"
  "nav_msgs"
  "pcl_conversions"
  "rclcpp"
  "std_msgs"
  "sensor_msgs"
  "tf2"
  "tf2_msgs"
  "tf2_ros"
  "tf2_geometry_msgs"
  "visualization_msgs"
)

install(TARGETS slam_rosbag_validate
  ARCHIVE DESTINATION lib/${PROJECT_NAME}
  LIBRARY DESTINATION lib/${PROJECT_NAME}
  RUNTIME DESTINATION lib/${PROJECT_NAME}
)

add_executable(slam_pbstream_to_ros_map
  pbstream_to_ros_map_main.cc
)

target_include_directories(slam_pbstream_to_ros_map 
  PRIVATE 
    slam_ros_msgs
)

target_link_libraries(slam_pbstream_to_ros_map ${PROJECT_NAME})

ament_target_dependencies(slam_pbstream_to_ros_map
  "agv_msgs"
  "agv_srvs"
  "slam_ros_msgs"
  "geometry_msgs"
  "nav_msgs"
  "pcl_conversions"
  "rclcpp"
  "std_msgs"
  "sensor_msgs"
  "tf2"
  "tf2_msgs"
  "tf2_ros"
  "tf2_geometry_msgs"
  "visualization_msgs"
)

install(TARGETS slam_pbstream_to_ros_map
  ARCHIVE DESTINATION lib/${PROJECT_NAME}
  LIBRARY DESTINATION lib/${PROJECT_NAME}
  RUNTIME DESTINATION lib/${PROJECT_NAME}
)

add_executable(slam_pbstream_map_publisher
  pbstream_map_publisher_main.cc
)

target_include_directories(slam_pbstream_map_publisher 
  PRIVATE 
    slam_ros_msgs
)

target_link_libraries(slam_pbstream_map_publisher ${PROJECT_NAME})

ament_target_dependencies(slam_pbstream_map_publisher
  "agv_msgs"
  "agv_srvs"
  "slam_ros_msgs"
  "geometry_msgs"
  "nav_msgs"
  "pcl_conversions"
  "rclcpp"
  "std_msgs"
  "sensor_msgs"
  "tf2"
  "tf2_msgs"
  "tf2_ros"
  "tf2_geometry_msgs"
  "visualization_msgs"
)

install(TARGETS slam_pbstream_map_publisher
  ARCHIVE DESTINATION lib/${PROJECT_NAME}
  LIBRARY DESTINATION lib/${PROJECT_NAME}
  RUNTIME DESTINATION lib/${PROJECT_NAME}
)

add_executable(slam_dev_pbstream_trajectories_to_rosbag
  dev/pbstream_trajectories_to_rosbag_main.cc
)

target_include_directories(slam_dev_pbstream_trajectories_to_rosbag 
  PRIVATE 
    slam_ros_msgs
)

target_link_libraries(slam_dev_pbstream_trajectories_to_rosbag ${PROJECT_NAME})

ament_target_dependencies(slam_dev_pbstream_trajectories_to_rosbag
  "agv_msgs"
  "agv_srvs"
  "slam_ros_msgs"
  "geometry_msgs"
  "nav_msgs"
  "pcl_conversions"
  "rclcpp"
  "std_msgs"
  "sensor_msgs"
  "tf2"
  "tf2_msgs"
  "tf2_ros"
  "tf2_geometry_msgs"
  "visualization_msgs"
)

install(TARGETS slam_dev_pbstream_trajectories_to_rosbag
  ARCHIVE DESTINATION lib/${PROJECT_NAME}
  LIBRARY DESTINATION lib/${PROJECT_NAME}
  RUNTIME DESTINATION lib/${PROJECT_NAME}
)

add_executable(slam_dev_rosbag_publisher
  dev/rosbag_publisher_main.cc
)

target_include_directories(slam_dev_rosbag_publisher 
  PRIVATE 
    slam_ros_msgs
)

target_link_libraries(slam_dev_rosbag_publisher ${PROJECT_NAME})

ament_target_dependencies(slam_dev_rosbag_publisher
  "agv_msgs"
  "agv_srvs"
  "slam_ros_msgs"
  "geometry_msgs"
  "nav_msgs"
  "pcl_conversions"
  "rclcpp"
  "std_msgs"
  "sensor_msgs"
  "tf2"
  "tf2_msgs"
  "tf2_ros"
  "tf2_geometry_msgs"
  "visualization_msgs"
)

install(TARGETS slam_dev_rosbag_publisher
  ARCHIVE DESTINATION lib/${PROJECT_NAME}
  LIBRARY DESTINATION lib/${PROJECT_NAME}
  RUNTIME DESTINATION lib/${PROJECT_NAME}
)

add_executable(slam_dev_trajectory_comparison
  dev/trajectory_comparison_main.cc
)

target_include_directories(slam_dev_trajectory_comparison 
  PRIVATE 
    slam_ros_msgs
)

target_link_libraries(slam_dev_trajectory_comparison ${PROJECT_NAME})

ament_target_dependencies(slam_dev_trajectory_comparison
  "agv_msgs"
  "agv_srvs"
  "slam_ros_msgs"
  "geometry_msgs"
  "nav_msgs"
  "pcl_conversions"
  "rclcpp"
  "std_msgs"
  "sensor_msgs"
  "tf2"
  "tf2_msgs"
  "tf2_ros"
  "tf2_geometry_msgs"
  "visualization_msgs"
)

install(TARGETS slam_dev_trajectory_comparison
  ARCHIVE DESTINATION lib/${PROJECT_NAME}
  LIBRARY DESTINATION lib/${PROJECT_NAME}
  RUNTIME DESTINATION lib/${PROJECT_NAME}
)


